<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Module      :  Data.Array</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow 2001</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Stability   :  provisional</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Basic non-strict arrays.</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- /Note:/ The &quot;Data.Array.IArray&quot; module provides a more general interface</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- to immutable arrays: it defines operations with the same names as</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- those defined below, but with more general types, and also defines</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- 'Array' instances of the relevant classes.  To use that more general</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- interface, import &quot;Data.Array.IArray&quot; but not &quot;Data.Array&quot;.</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Array</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-23"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Immutable non-strict arrays</span></span><span>
</span><span id="line-24"></span><span>    </span><span class="annot"><span class="hs-comment">-- $intro</span></span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-keyword">module</span><span> </span><span class="annot"><a href="../../base/src/Data.Ix.html#"><span class="hs-identifier">Data.Ix</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- export all of Ix</span><span>
</span><span id="line-26"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#Array"><span class="hs-identifier">Array</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- Array type is abstract</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Array construction</span></span><span>
</span><span id="line-29"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#array"><span class="hs-identifier">array</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- :: (Ix a) =&gt; (a,a) -&gt; [(a,b)] -&gt; Array a b</span><span>
</span><span id="line-30"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#listArray"><span class="hs-identifier">listArray</span></a></span><span class="hs-special">,</span><span>      </span><span class="hs-comment">-- :: (Ix a) =&gt; (a,a) -&gt; [b] -&gt; Array a b</span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#accumArray"><span class="hs-identifier">accumArray</span></a></span><span class="hs-special">,</span><span>     </span><span class="hs-comment">-- :: (Ix a) =&gt; (b -&gt; c -&gt; b) -&gt; b -&gt; (a,a) -&gt; [(a,c)] -&gt; Array a b</span><span>
</span><span id="line-32"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Accessing arrays</span></span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#%21"><span class="hs-operator">(!)</span></a></span><span class="hs-special">,</span><span>            </span><span class="hs-comment">-- :: (Ix a) =&gt; Array a b -&gt; a -&gt; b</span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#bounds"><span class="hs-identifier">bounds</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- :: (Ix a) =&gt; Array a b -&gt; (a,a)</span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#indices"><span class="hs-identifier">indices</span></a></span><span class="hs-special">,</span><span>        </span><span class="hs-comment">-- :: (Ix a) =&gt; Array a b -&gt; [a]</span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#elems"><span class="hs-identifier">elems</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- :: (Ix a) =&gt; Array a b -&gt; [b]</span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#assocs"><span class="hs-identifier">assocs</span></a></span><span class="hs-special">,</span><span>         </span><span class="hs-comment">-- :: (Ix a) =&gt; Array a b -&gt; [(a,b)]</span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Incremental array updates</span></span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#%2F%2F"><span class="hs-operator">(//)</span></a></span><span class="hs-special">,</span><span>           </span><span class="hs-comment">-- :: (Ix a) =&gt; Array a b -&gt; [(a,b)] -&gt; Array a b</span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#accum"><span class="hs-identifier">accum</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- :: (Ix a) =&gt; (b -&gt; c -&gt; b) -&gt; Array a b -&gt; [(a,c)] -&gt; Array a b</span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Derived arrays</span></span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Arr.html#ixmap"><span class="hs-identifier">ixmap</span></a></span><span class="hs-special">,</span><span>          </span><span class="hs-comment">-- :: (Ix a, Ix b) =&gt; (a,a) -&gt; (a -&gt; b) -&gt; Array b c -&gt; Array a b</span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span>    </span><span class="hs-comment">-- Array instances:</span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-comment">--   Ix a =&gt; Functor (Array a)</span><span>
</span><span id="line-47"></span><span>    </span><span class="hs-comment">--   (Ix a, Eq b)  =&gt; Eq   (Array a b)</span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-comment">--   (Ix a, Ord b) =&gt; Ord  (Array a b)</span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-comment">--   (Ix a, Show a, Show b) =&gt; Show (Array a b)</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-comment">--   (Ix a, Read a, Read b) =&gt; Read (Array a b)</span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-52"></span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-comment">-- Implementation checked wrt. Haskell 98 lib report, 1/99.</span><span>
</span><span id="line-54"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Ix.html#"><span class="hs-identifier">Data.Ix</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Arr.html#"><span class="hs-identifier">GHC.Arr</span></a></span><span>  </span><span class="hs-comment">-- Most of the hard work is done here</span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-comment">{- $intro
Haskell provides indexable /arrays/, which may be thought of as functions
whose domains are isomorphic to contiguous subsets of the integers.
Functions restricted in this way can be implemented efficiently;
in particular, a programmer may reasonably expect rapid access to
the components.  To ensure the possibility of such an implementation,
arrays are treated as data, not as general functions.

Since most array functions involve the class 'Ix', this module is exported
from &quot;Data.Array&quot; so that modules need not import both &quot;Data.Array&quot; and
&quot;Data.Ix&quot;.
-}</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span></pre></body></html>